package org.jeie.gui.panels;

import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.SpringLayout;

public class MainPanel extends JPanel {
	private static final long serialVersionUID = 8653997851711456306L;

	public GUIPanel gui;
	public ToolboxPanel toolbox;

	public MainPanel() {
		setPreferredSize(new Dimension(512, 512));
		setBackground(Color.magenta);

		SpringLayout layout = new SpringLayout();
		setLayout(layout);

		toolbox = new ToolboxPanel();
		add(toolbox);
		gui = new GUIPanel(this);
		//add(gui);

		JScrollPane p = new JScrollPane(gui);
		p.setPreferredSize(gui.getPreferredSize());
		add(p);

		//toolbox
		layout.putConstraint(
			SpringLayout.NORTH,
			toolbox,
			0,
			SpringLayout.NORTH,
			this);
		layout.putConstraint(
			SpringLayout.WEST,
			toolbox,
			0,
			SpringLayout.WEST,
			this);
		layout.putConstraint(
			SpringLayout.SOUTH,
			toolbox,
			0,
			SpringLayout.SOUTH,
			this);
		layout.putConstraint(
			SpringLayout.EAST,
			toolbox,
			48,
			SpringLayout.WEST,
			this);
		//gui
		layout
			.putConstraint(SpringLayout.NORTH, p, 0, SpringLayout.NORTH, this);
		layout.putConstraint(
			SpringLayout.WEST,
			p,
			0,
			SpringLayout.EAST,
			toolbox);
		layout
			.putConstraint(SpringLayout.SOUTH, p, 0, SpringLayout.SOUTH, this);
		layout.putConstraint(SpringLayout.EAST, p, 0, SpringLayout.EAST, this);
	}
}
